package com.lk.springboot.mapper;

import java.util.List;

import com.lk.springboot.bean.Category;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface CategoryMapper {

    @Select("select * from dd_book ")
    List<Category> findAll();

    @Insert(" insert into dd_book ( title , author, price ,date,comments ) values (#{title},#{author},#{price},#{date},#{comments}) ")
    public int save(Category category);

    @Delete(" delete from dd_book where id= #{id} ")
    public void delete(int id);

    @Select("select * from dd_book where id= #{id} ")
    public Category get(int id);

    @Update("update dd_book set title=#{title},author=#{author},price=#{price},date=#{date},comments=#{comments} where id=#{id} ")
    public int update(Category category);

}